﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using COM.Rights.Model;
using COM.Rights.BLL;
using System.Web.UI.WebControls;

public partial class FrontPages_UserControl_ReviewSmall : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack) {
            InitReviewSmall();
        }
    }

    public string StyleName
    {
        get
        {
            return CssControler.GetCssFileNameByHost(HostName);
        }
    } 


    private string _HostName;
    public string HostName
    {
        get
        {
            if (StringHelper.FormatObjToString(ViewState["HostName"]) != string.Empty)
            {
                return StringHelper.FormatObjToString(ViewState["HostName"]);
            }
            else if (!string.IsNullOrEmpty(hidHostName.Value))
            { ViewState["HostName"] = hidHostName.Value; return hidHostName.Value; }

            return this._HostName;
        }
        set
        {
            ViewState["HostName"] = value;
        }
    }



    public void InitReviewSmall() {
        BdReviews _BdReviews = new BdReviews();
        repMessageList.DataSource = _BdReviews.GetTop(8, "Content", string.Format(" HostName LIKE '%{0}%' AND IsDelete = 0 AND  IsPublish = 1", HostName), "ReplyDate DESC", new List<DBParameter>());
        repMessageList.DataBind();
    }

}